<!DOCTYPE HTML>
<html style="background-color:rgb(249,249,251)">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>changestudentmsg</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/pair.css" />
    <link rel="stylesheet" type="text/css" href="../../css/font-awesome.css" />

</head>

<style media="screen">
</style>

<body>
    <header class="aui-bar aui-bar-nav" style="background-color:white;position:fixed;z-index:2;height:2.5rem;padding-top:0.8rem">
        <a class="aui-pull-left aui-btn" onclick="api.closeWin()">
            <i style="color:black" class="fa fa-chevron-left" aria-hidden="true"></i>
        </a>
        <div class="aui-title" style="color:black">修改学生信息</div>
        <a class="aui-pull-right">
            <span>
                <img src="../../image/321AC.png" style="padding-top:0.25rem;">
            </span>
        </a>
    </header>

    <div class="aui-content aui-margin-b-15" style="margin-top:0.25rem">
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        姓名:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_name" value="{{student.name}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        姓名:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_name" value="{{student.name}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        性别:
                    </div>
                    <div class="aui-list-item-input">
                        <!-- <input v-if="student.gender==0" type="text" v-model="stu_sex" value="男">
                        <input v-else="student.gender==1" type="text" v-model="stu_sex" value="女"> -->
                        <select v-model="stu_sex">
                            <option disabled v-if="student.gender==0" value="">男</option>
                            <option disabled v-else="student.gender==1" value="">女</option>
                            <option value="男">男</option>
                            <option value="女">女</option>
                        </select>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        班级:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_banji" value="{{student.clazz}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        民族:
                    </div>
                    <div class="aui-list-item-input" @click="select()">
                        <input type="text" v-model="stu_nation" readonly value="{{student.nation.itemValue}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        政治面貌:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_zzmm" value="{{student.zzmm}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        家庭地址:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_addr" value="{{student.homeAddr}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        身份证号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_idcard" value="{{student.idCard}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        学号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_sno" value="{{student.sno}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        qq号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_qqid" value="{{student.qq}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        宿舍号:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_docuid" value="{{student.susheSno}}">
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        联系电话:
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" v-model="stu_phone" value="{{student.phone}}">
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="aui-btn aui-btn-info aui-btn-block aui-btn-sm" style="width:70%!important;margin-left:15%!important"
        @click="sure()">确认修改</div>
</body>

<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue1.0.js"></script>
<script type="text/javascript" src="../../script/util.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript">
    apiready = function () {
        vm = new Vue({
            el: "body",
            data: {
                student: {},
                stu_name: "",
                stu_sex: "",
                stu_addr: "",
                stu_banji: "",
                stu_nation: "",
                stu_docuid: "",
                stu_qqid: "",
                stu_zzmm: "",
                stu_sno: "",
                stu_idcard: "",
                stu_phone: "",
                nation: []
            },
            methods: {
                cancel: function () {
                    api.openWin({
                        name: 'StudentInformation',
                        url: './StudentInformation.html',
                        pageParam: {
                            name: 'test'
                        }
                    });
                },
                select: function () {
                    var me = this;
                    api.actionSheet({
                        title: '选择民族',
                        cancelTitle: '取消',
                        buttons: me.nation
                    }, function (ret, err) {
                        var index = ret.buttonIndex;

                        if (index == 57) {
                            me.stu_nation = me.student.nation.itemValue;
                        } else {
                            me.stu_nation = me.nation[index - 1];
                        }
                    });
                },

                sure: function () {
                    var me = this;
                    api.ajax({
                        url: serverIp + "/friend/changemsgStudent.do",
                        method: 'post',
                        data: {
                            values: {
                                oid: me.student.oid,
                                stu_name: me.stu_name,
                                stu_sex: me.stu_sex,
                                stu_addr: me.stu_addr,
                                stu_banji: me.stu_banji,
                                stu_nation: me.stu_nation,
                                stu_docuid: me.stu_docuid,
                                stu_qqid: me.stu_qqid,
                                stu_zzmm: me.stu_zzmm,
                                stu_sno: me.stu_sno,
                                stu_idcard: me.stu_idcard,
                                stu_phone: me.stu_phone
                            }
                        }
                    }, function (ret, err) {
                        if (ret) {
                            alert("修改成功");
                            api.execScript({
                                name: 'StudentInformation',
                                script: 'shuaxin()'
                            });
                            api.closeWin();


                        } else {
                            alert(JSON.stringify(err));
                        }
                    });
                    if (me.student.gender == 0) {
                        me.student.gender = "男";
                        console.log(me.student.gender)
                    } else if (me.student.gender == 1) {
                        me.student.gender = "女";
                        console.log(me.student.gender)
                    }

                }
            },
            created: function () {
                var me = this;
                var value = api.pageParam["student"];
                me.student = value;
                $api.get(serverIp + "/friend/nationtypeActivity.do", function (ret) {
                    if (ret) {
                        me.nation = ret.data;
                        api.setPrefs({
                            key: 'nation',
                            value: me.nation
                        });
                    }
                }, 'JSON');
            },
        });
    }
</script>

</html>